package com.shelpe.services.sinbad.repository.jpa;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.shelpe.services.sinbad.entity.jpa.MobileKeywordsDetail;
import com.shelpe.services.sinbad.entity.jpa.MobileKeywordsDetail.MobilePK;
import com.shelpe.services.sinbad.entity.jpa.MobileKeywordsDetail.Status;

public interface MobileKeywordsRepository extends PagingAndSortingRepository<MobileKeywordsDetail,MobilePK>{
	
	@Query("select concat(po.mobileAdgroupID,'-',count(*)) from com.shelpe.services.sinbad.entity.jpa.MobileKeywordsDetail po GROUP BY po.mobileAdgroupID")
	List<String> findKeywordNumsByMobileAdgroupID();
	
	List<MobileKeywordsDetail> findByMobileAdgroupID(long mobileAdgroupID);
	
	List<MobileKeywordsDetail> findByAdgroupIDAndStatus(long adgroupID, Status status);
	
	int deleteByMobileAdgroupID(long mobileAdgroupID);
}
